﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace Asion.Dapper
{
    /// <summary>
    /// SqlServer 数据提供
    /// </summary>
    public sealed class MySqlDbProvider : DbProvider
    {
        public override DbProviderFactory Factory => MySqlConnector.MySqlConnectorFactory.Instance;

        public DbConnection GetConnection(string connectionString)
        {
            var csb = Factory.CreateConnectionStringBuilder()!;
            csb.ConnectionString = connectionString;
            ((dynamic)csb).AllowZeroDateTime = false;
            ((dynamic)csb).ConvertZeroDateTime = false;
            var conn = Factory.CreateConnection()!;
            conn.ConnectionString = csb.ConnectionString;
            return conn;
        }
    }
}
